package ThreadDemo;

public class ThreadDemo9 {
    //验证interrupted与isinterrupted的区别
    public static void main(String[] args) {
//        Thread t1 = new Thread(()->{
//            for (int i = 0; i < 5; i++) {
//                System.out.println("interrupt:"+Thread.interrupted());
//            }
//        });
//        t1.start();
//        t1.interrupt();
        Thread t2 = new Thread(()->{

        });
        t2.start();
        t2.interrupt();
        for (int i = 0; i < 5; i++) {
            System.out.println("isinterrupted:"+t2.isInterrupted());
        }
    }
}
